#region Copyright RenGuiYou. All rights reserved.
//=====================================================
// NeatlyFrameWork
// Author:      RenGuiyou
// Feedback: 	mailto:750539605@qq.com
//=====================================================
#endregion

using System;
public class NDispose : IDisposable
{
    protected bool m_IsDispose;
    ~NDispose()
    {
        Dispose(false);
    }
    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    protected virtual void Dispose(bool safe)
    {
        if (m_IsDispose) return;
        if (safe)
        {
            //清理子Dispose
            DisposeAll();
        }
        //清理非托管
        DisposeUnmanned();
        m_IsDispose = true;
    }

    protected virtual void DisposeAll() { }
    protected virtual void DisposeUnmanned() { }
}
